#ifndef __QUE_STRUCT_TYPE_H__
#define __QUE_STRUCT_TYPE_H__

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

#include "mcu_ver_sect.h"

typedef struct 
{
	uint16_t u6high:6;
	uint16_t mark:2;
}__attribute__((__packed__)) defCyclOpsHighDis;

typedef union 
{
	uint8_t byte;
	defCyclOpsHighDis highdis;
}__attribute__((__packed__)) unCyclOpsHighDis ;

typedef struct 
{
	uint8_t u8low;
	unCyclOpsHighDis unhigh;
}__attribute__((__packed__)) defCyclOpsDis;

typedef struct 
{
	uint8_t u8low;
	uint8_t u8high;
}__attribute__((__packed__)) defCyclOpsAmp;

typedef struct 
{
	uint8_t u8low;
	uint8_t u8high;
}__attribute__((__packed__)) defCyclOpsCrc;

typedef struct 
{
	uint8_t head;
	uint8_t len;
	defCyclOpsDis dis;
	defCyclOpsAmp amp;
	uint8_t u8car;
	uint8_t u8resv;
	defCyclOpsCrc crc;
}__attribute__((__packed__)) defCyclOpsProto;


typedef struct 
{
	defCyclOpsDis dis;
	defCyclOpsAmp amp;
}__attribute__((__packed__)) defCpuDisAmp;   // mcu send to cpu soc
// note: distance in mcu is cm,  distance in CyclOps(yi tian) is mm, 

#if 1
typedef enum
{
    enmTypeU08=0,
    enmTypeU16=1,
    enmTypeU32=2,
    enmTypeMcuCpuDisAmp=3,
    enmTypeUnDef=2,
}enmTypeQue;
#endif

//#define defFrameCpuDisAmp 61
#define defFrameCpuDisAmp 5

#if 1
typedef struct
{
	enmTypeQue type;
  uint16_t countMax;
  void* pData;
}__attribute__((__packed__)) defQueAttr; //__attribute__ ((packed)) typeQueue;
#endif

#if 1
typedef struct
{
   defQueAttr* pattr;
    //def_PT pt_buf;
    //uint16_t count;
  int16_t front;
  int16_t rear;
	
  //enmTypeQue type;
  //uint16_t countMax;
  //void* pData;		
}__attribute__((__packed__)) defTypeQue; //__attribute__ ((packed)) typeQueue;
#endif

#if 1
//typedef defTypeQue
typedef struct __attribute__ ((packed))
{
	void (*init)( defTypeQue *q );
	
    bool (*push_back)(defTypeQue *q, void* e);
    bool (*pop_front)(defTypeQue *q, void* e);

    bool (*get_index)(defTypeQue *q,uint16_t i,void* v);
    int (*length)(defTypeQue *q);
}__attribute__((__packed__)) defQueFunc; //__attribute__ ((packed)) typeQueue;
#endif

const defQueFunc* get_pt_que_func(void);


//int getRtcMaxCount(void);

#endif

